package ui.panel;

/**
 * Bereich Panel
 * @author Christian Wolpers
 */

import java.awt.BorderLayout;
import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;

import ui.HatSuchfeld;
import ui.Mainframe;


public class BereichPanel extends JPanel implements HatSuchfeld{
	private Mainframe frame;
		
	
	private JTextField textFieldSuche;
	private JTextField textFieldName;
	
	private JTable table;
	
	/** Testdaten **/
	String[][] rowData = {
		    { "ITA1a"}, { "ITA2a" }, { "ITA3a" },
		    { "ITA1b"},{ "ITA2b" },{ "ITA3b" },
		    { "ITA1c"},{ "ITA2c" },{ "ITA3c" }};
	
	String[] columnNames = {"Name"};
	
	public BereichPanel(Mainframe frame)
    {
		setLayout(new BorderLayout(0, 0));
		
		JPanel panelOben = new JPanel();
		add(panelOben, BorderLayout.NORTH);
		panelOben.setLayout(new BorderLayout(0, 0));
		
		JPanel panelObenSuche = new JPanel();
		panelOben.add(panelObenSuche, BorderLayout.NORTH);
		panelObenSuche.setLayout(new GridLayout(1, 0, 0, 0));
		
		JLabel labelSuche = new JLabel("Suche:");
		panelObenSuche.add(labelSuche);
		
		textFieldSuche = new JTextField();
		labelSuche.setLabelFor(textFieldSuche);
		panelObenSuche.add(textFieldSuche);
		textFieldSuche.setColumns(10);
		
		JPanel panelObenListe = new JPanel();
		panelOben.add(panelObenListe, BorderLayout.CENTER);
		panelObenListe.setLayout(new BorderLayout());

		table = new JTable(rowData, columnNames);
		table.setRowSelectionAllowed(true);
		
		JScrollPane scrollpane = new JScrollPane(table);
		
		panelObenListe.add(scrollpane, BorderLayout.CENTER);
		
		JPanel panelObenButton = new JPanel();
		panelOben.add(panelObenButton, BorderLayout.SOUTH);
		panelObenButton.setLayout(new GridLayout(0, 2, 0, 0));
		
		JButton buttonBearbeiten = new JButton("Bearbeiten");
		panelObenButton.add(buttonBearbeiten);
		
		JButton buttonLoeschen = new JButton("L\u00F6schen");
		panelObenButton.add(buttonLoeschen);
		
		JPanel panelUnten = new JPanel();
		add(panelUnten, BorderLayout.CENTER);
		panelUnten.setLayout(new BorderLayout(0, 0));
		
		JPanel panelUntenFormular = new JPanel();
		panelUnten.add(panelUntenFormular, BorderLayout.NORTH);
		panelUntenFormular.setLayout(new GridLayout(0, 2, 0, 0));
		
		JLabel labelName = new JLabel("Name des Bereiches:");
		panelUntenFormular.add(labelName);
		
		textFieldName = new JTextField();
		labelName.setLabelFor(textFieldName);
		panelUntenFormular.add(textFieldName);
		textFieldName.setColumns(10);		
		
		
		JPanel panelUntenButton = new JPanel();
		panelUnten.add(panelUntenButton);
		panelUntenButton.setLayout(new GridLayout(1, 3, 0, 0));
		
		JButton buttonNeuAnlegen = new JButton("Neu anlegen");
		panelUntenButton.add(buttonNeuAnlegen);
		
		JButton buttonSpeichern = new JButton("Speichern");
		panelUntenButton.add(buttonSpeichern);
		
		JButton buttonZurueck = new JButton("Zur\u00FCck");
		panelUntenButton.add(buttonZurueck);
    }

	@Override
	public void suche() {
		// TODO Auto-generated method stub
		
	}
	
    
    
}